GATE Exam  >  GATE Questions  >  Find the output of the following program.main... Start Learning for Free
Find the output of the following program.
main()
{
int i =_1_abc(10);
print f ("%d\n",--i);
}
int_1_abc(int i)
{
return(i ++);
}
  • a)
    1
  • b)
    5
  • c)
    9
  • d)
    11
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
Find the output of the following program.main(){int i =_1_abc(10);prin...
The function is returning i++ which is post incremental, so first the value of i which is 10 will be returned and then it will be incremented. so the value of i in the main function will be 10 and printing --i will print 9.
View all questions of this test
Most Upvoted Answer
Find the output of the following program.main(){int i =_1_abc(10);prin...
Explanation:

Main Function:
- The main function calls the _1_abc function with the argument 10 and assigns the return value to variable i.
- Then it prints the value of --i, which decrements the value of i before printing.

_1_abc Function:
- The _1_abc function takes an integer input i and returns i++.
- This means it increments the input value i and returns the result.

Output Calculation:
- In the main function, _1_abc(10) is called, which increments 10 to 11 and returns 11.
- This value is then decremented by 1 in --i, resulting in 10.
- Therefore, the output of the program is 10.
Therefore, the correct answer is option C) 9.
Explore Courses for GATE exam
Find the output of the following program.main(){int i =_1_abc(10);print f ("%d\n",--i);}int_1_abc(int i){return(i ++);}a)1b)5c)9d)11Correct answer is option 'C'. Can you explain this answer?
Question Description
Find the output of the following program.main(){int i =_1_abc(10);print f ("%d\n",--i);}int_1_abc(int i){return(i ++);}a)1b)5c)9d)11Correct answer is option 'C'. Can you explain this answer? for GATE 2024 is part of GATE preparation. The Question and answers have been prepared according to the GATE exam syllabus. Information about Find the output of the following program.main(){int i =_1_abc(10);print f ("%d\n",--i);}int_1_abc(int i){return(i ++);}a)1b)5c)9d)11Correct answer is option 'C'. Can you explain this answer? covers all topics & solutions for GATE 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Find the output of the following program.main(){int i =_1_abc(10);print f ("%d\n",--i);}int_1_abc(int i){return(i ++);}a)1b)5c)9d)11Correct answer is option 'C'. Can you explain this answer?.
Solutions for Find the output of the following program.main(){int i =_1_abc(10);print f ("%d\n",--i);}int_1_abc(int i){return(i ++);}a)1b)5c)9d)11Correct answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for GATE. Download more important topics, notes, lectures and mock test series for GATE Exam by signing up for free.
Here you can find the meaning of Find the output of the following program.main(){int i =_1_abc(10);print f ("%d\n",--i);}int_1_abc(int i){return(i ++);}a)1b)5c)9d)11Correct answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Find the output of the following program.main(){int i =_1_abc(10);print f ("%d\n",--i);}int_1_abc(int i){return(i ++);}a)1b)5c)9d)11Correct answer is option 'C'. Can you explain this answer?, a detailed solution for Find the output of the following program.main(){int i =_1_abc(10);print f ("%d\n",--i);}int_1_abc(int i){return(i ++);}a)1b)5c)9d)11Correct answer is option 'C'. Can you explain this answer? has been provided alongside types of Find the output of the following program.main(){int i =_1_abc(10);print f ("%d\n",--i);}int_1_abc(int i){return(i ++);}a)1b)5c)9d)11Correct answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Find the output of the following program.main(){int i =_1_abc(10);print f ("%d\n",--i);}int_1_abc(int i){return(i ++);}a)1b)5c)9d)11Correct answer is option 'C'. Can you explain this answer? tests, examples and also practice GATE tests.
Explore Courses for GATE exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev